package com.campus.merchant.entity;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.Setter;

import java.math.BigDecimal;
import java.time.LocalDateTime;

/**
 * <p>
 * 订单表
 * </p>
 *
 * @author ZhaoYuJie
 * @since 2025-04-18
 */
@Getter
@Setter
@TableName("`order`")
@ApiModel(value = "Order对象", description = "订单表")
public class Order {

    private static final long serialVersionUID = 1L;

    @ApiModelProperty("订单ID")
    @TableId(value = "id")
    private String id;

    @ApiModelProperty("用户ID")
    @TableField("user_id")
    private Integer userId;

    @ApiModelProperty("顾客电话")
    @TableField("customer_phone")
    private String customerPhone;

    @ApiModelProperty("商户ID")
    @TableField("merchant_id")
    private Integer merchantId;

    @ApiModelProperty("商户名称")
    @TableField("merchant_name")
    private String merchantName;

    @ApiModelProperty("商户Logo")
    @TableField("merchant_logo")
    private String merchantLogo;

    @ApiModelProperty("商户电话")
    @TableField("merchant_phone")
    private String merchantPhone;

    @ApiModelProperty("配送员ID")
    @TableField("delivery_id")
    private Integer deliveryId;

    @ApiModelProperty("配送员电话")
    @TableField("delivery_phone")
    private String deliveryPhone;

    @ApiModelProperty("状态：1-待付款，2-待接单，3-进行中，4-已完成，5-已取消")
    @TableField("status")
    private Integer status;

    @ApiModelProperty("状态文本")
    @TableField("status_text")
    private String statusText;

    @ApiModelProperty("商家进度：0-待接单，1-备餐中，2-已出餐")
    @TableField("merchant_process")
    private Integer merchantProcess;

    @ApiModelProperty("商家进度文本")
    @TableField("merchant_process_text")
    private String merchantProcessText;

    @ApiModelProperty("配送员进度：0-待抢单，1-待取餐，2-配送中，3-已送达")
    @TableField("delivery_process")
    private Integer deliveryProcess;

    @ApiModelProperty("配送员进度文本")
    @TableField("delivery_process_text")
    private String deliveryProcessText;

    @ApiModelProperty("创建时间")
    @TableField("create_time")
    private LocalDateTime createTime;

    @ApiModelProperty("支付时间")
    @TableField("pay_time")
    private LocalDateTime payTime;

    @ApiModelProperty("配送时间")
    @TableField("delivery_time")
    private LocalDateTime deliveryTime;

    @ApiModelProperty("完成时间")
    @TableField("finish_time")
    private LocalDateTime finishTime;

    @ApiModelProperty("取消时间")
    @TableField("cancel_time")
    private LocalDateTime cancelTime;

    @ApiModelProperty("取消原因")
    @TableField("cancel_reason")
    private String cancelReason;

    @ApiModelProperty("商品总价")
    @TableField("total_price")
    private BigDecimal totalPrice;

    @ApiModelProperty("原价")
    @TableField("original_price")
    private BigDecimal originalPrice;

    @ApiModelProperty("配送费")
    @TableField("delivery_fee")
    private BigDecimal deliveryFee;

    @ApiModelProperty("总打包费（商品打包费累加）")
    @TableField("total_packaging_fee")
    private BigDecimal totalPackagingFee;

    @ApiModelProperty("优惠金额")
    @TableField("discount")
    private BigDecimal discount;

    @ApiModelProperty("实付金额")
    @TableField("actual_pay")
    private BigDecimal actualPay;

    @ApiModelProperty("配送类型：1-外卖，2-堂食，3-自取")
    @TableField("delivery_type")
    private Integer deliveryType;

    @ApiModelProperty("收货人姓名")
    @TableField("receiver_name")
    private String receiverName;

    @ApiModelProperty("收货人电话")
    @TableField("receiver_phone")
    private String receiverPhone;

    @ApiModelProperty("配送地址")
    @TableField("delivery_address")
    private String deliveryAddress;

    @ApiModelProperty("备注")
    @TableField("remark")
    private String remark;

    @ApiModelProperty("支付方式ID")
    @TableField("payment_method_id")
    private Integer paymentMethodId;

    @ApiModelProperty("使用的用户优惠券表ID")
    @TableField("user_coupon_id")
    private Integer userCouponId;

    @ApiModelProperty("使用的积分")
    @TableField("points_used")
    private Integer pointsUsed;

    @ApiModelProperty("积分抵扣金额")
    @TableField("points_discount")
    private BigDecimal pointsDiscount;

    @ApiModelProperty("是否已结算收益：0-未结算，1-已结算")
    @TableField("profit_settled")
    private Integer profitSettled;

    @ApiModelProperty("商户收益")
    @TableField("merchant_profit")
    private BigDecimal merchantProfit;

    @ApiModelProperty("配送员收益")
    @TableField("delivery_profit")
    private BigDecimal deliveryProfit;

    @ApiModelProperty("平台收益")
    @TableField("platform_profit")
    private BigDecimal platformProfit;

    @ApiModelProperty("配送时间类型：1-尽快送达，2-预约")
    @TableField("delivery_time_type")
    private Integer deliveryTimeType;

    @ApiModelProperty("预约时间，当 delivery_time_type 为 schedule 时有效")
    @TableField("schedule_time")
    private String scheduleTime;

    @ApiModelProperty("微信支付订单号")
    @TableField("transaction_id")
    private String transactionId;

    @ApiModelProperty("是否已奖励积分：0-未奖励，1-已奖励")
    @TableField("points_rewarded")
    private Integer pointsRewarded;

    @ApiModelProperty("是否已统计收益：0-未统计，1-已统计")
    @TableField("earnings_settled")
    private Integer earningsSettled;

}
